import { Transform, TransformFnParams } from "class-transformer";
import {
  IsAlphanumeric,
  IsEmail,
  IsNotEmpty,
  IsString,
  MaxLength,
  MinLength,
} from "class-validator";
import IUser from "./user.interface";

/**
 * 注册需要用户名 游戏 和 密码
 */
class CreateUserDto implements IUser {
  @MinLength(3)
  @MaxLength(10)
  @Transform(({ value }: TransformFnParams) => value.trim())
  public name: string;
  @IsEmail()
  @Transform(({ value }: TransformFnParams) => value.trim())
  public email: string;

  @IsAlphanumeric()
  @MinLength(6)
  @MaxLength(10)
  @Transform(({ value }: TransformFnParams) => value.trim())
  public password: string;
}

export default CreateUserDto;
